import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class GUI
{
    static int mlx;
    static int mly;
    static JLabel l=new JLabel("hello");
    public static void main(String[] args) {
        JFrame jf=new JFrame();
        jf.setSize(750,500);
        jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
        Toolkit kit=Toolkit.getDefaultToolkit();
        Dimension sc=kit.getScreenSize();
        jf.setLocation(sc.width/2-200,sc.height/2-100);
        l.setBounds(30,65,120,169);
        l.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                mlx=e.getPoint().x;
                mly=e.getPoint().y;
            }
        });
        l.addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(MouseEvent e) {
                l.setBounds(e.getXOnScreen()-jf.getX()-mlx,e.getYOnScreen()-jf.getY()-mly,120,169);
            }
        });
        JPanel jp=new JPanel();
        jp.add(l);
        jp.setLayout(null);
        jf.getContentPane().add(jp);
        jf.show();
    }

}